{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "14e834b2",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "id": "cc7d080e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>name</th>\n",
       "      <th>age</th>\n",
       "      <th>weight</th>\n",
       "      <th>m0006</th>\n",
       "      <th>m0612</th>\n",
       "      <th>m1218</th>\n",
       "      <th>f0006</th>\n",
       "      <th>f0612</th>\n",
       "      <th>f1218</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1.0</td>\n",
       "      <td>Mickéy Mousé</td>\n",
       "      <td>56.0</td>\n",
       "      <td>70kgs</td>\n",
       "      <td>72</td>\n",
       "      <td>69</td>\n",
       "      <td>71</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2.0</td>\n",
       "      <td>Donald Duck</td>\n",
       "      <td>34.0</td>\n",
       "      <td>154.89lbs</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>85</td>\n",
       "      <td>84</td>\n",
       "      <td>76</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3.0</td>\n",
       "      <td>Mini Mouse</td>\n",
       "      <td>16.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>65</td>\n",
       "      <td>69</td>\n",
       "      <td>72</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4.0</td>\n",
       "      <td>Scrooge McDuck</td>\n",
       "      <td>NaN</td>\n",
       "      <td>78kgs</td>\n",
       "      <td>78</td>\n",
       "      <td>79</td>\n",
       "      <td>72</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5.0</td>\n",
       "      <td>Pink Panther</td>\n",
       "      <td>54.0</td>\n",
       "      <td>198.658lbs</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>69</td>\n",
       "      <td>NaN</td>\n",
       "      <td>75</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    id            name   age      weight m0006 m0612 m1218 f0006 f0612 f1218\n",
       "0  1.0    Mickéy Mousé  56.0       70kgs    72    69    71     -     -     -\n",
       "1  2.0     Donald Duck  34.0   154.89lbs     -     -     -    85    84    76\n",
       "2  3.0      Mini Mouse  16.0         NaN     -     -     -    65    69    72\n",
       "3  4.0  Scrooge McDuck   NaN       78kgs    78    79    72     -     -     -\n",
       "4  5.0    Pink Panther  54.0  198.658lbs     -     -     -    69   NaN    75"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "column_names= ['id', 'name', 'age', 'weight','m0006',\n",
    "                'm0612','m1218','f0006','f0612','f1218']\n",
    "df = pd.read_csv('data/patient_heart_rate.csv', names = column_names)\n",
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "id": "df197ca5",
   "metadata": {},
   "outputs": [],
   "source": [
    "df[['first_name','last_name']] = df.name.str.split(' ',expand=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "id": "ebdf6838",
   "metadata": {},
   "outputs": [],
   "source": [
    "df.drop('name',axis=1,inplace=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "id": "4df849c1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>age</th>\n",
       "      <th>weight</th>\n",
       "      <th>m0006</th>\n",
       "      <th>m0612</th>\n",
       "      <th>m1218</th>\n",
       "      <th>f0006</th>\n",
       "      <th>f0612</th>\n",
       "      <th>f1218</th>\n",
       "      <th>first_name</th>\n",
       "      <th>last_name</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1.0</td>\n",
       "      <td>56.0</td>\n",
       "      <td>70kgs</td>\n",
       "      <td>72</td>\n",
       "      <td>69</td>\n",
       "      <td>71</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>Mickéy</td>\n",
       "      <td>Mousé</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2.0</td>\n",
       "      <td>34.0</td>\n",
       "      <td>154.89lbs</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>85</td>\n",
       "      <td>84</td>\n",
       "      <td>76</td>\n",
       "      <td>Donald</td>\n",
       "      <td>Duck</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3.0</td>\n",
       "      <td>16.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>65</td>\n",
       "      <td>69</td>\n",
       "      <td>72</td>\n",
       "      <td>Mini</td>\n",
       "      <td>Mouse</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>78kgs</td>\n",
       "      <td>78</td>\n",
       "      <td>79</td>\n",
       "      <td>72</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>Scrooge</td>\n",
       "      <td>McDuck</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5.0</td>\n",
       "      <td>54.0</td>\n",
       "      <td>198.658lbs</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>69</td>\n",
       "      <td>NaN</td>\n",
       "      <td>75</td>\n",
       "      <td>Pink</td>\n",
       "      <td>Panther</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    id   age      weight m0006 m0612 m1218 f0006 f0612 f1218 first_name  \\\n",
       "0  1.0  56.0       70kgs    72    69    71     -     -     -     Mickéy   \n",
       "1  2.0  34.0   154.89lbs     -     -     -    85    84    76     Donald   \n",
       "2  3.0  16.0         NaN     -     -     -    65    69    72       Mini   \n",
       "3  4.0   NaN       78kgs    78    79    72     -     -     -    Scrooge   \n",
       "4  5.0  54.0  198.658lbs     -     -     -    69   NaN    75       Pink   \n",
       "\n",
       "  last_name  \n",
       "0     Mousé  \n",
       "1      Duck  \n",
       "2     Mouse  \n",
       "3    McDuck  \n",
       "4   Panther  "
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "id": "bf6d5fe0",
   "metadata": {},
   "outputs": [],
   "source": [
    "lbs_weight_s = df[df.weight.str.contains(\"lbs\").fillna(False)]['weight']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "id": "c9563f9c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1     154.89lbs\n",
       "4    198.658lbs\n",
       "5        189lbs\n",
       "9        189lbs\n",
       "Name: weight, dtype: object"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "lbs_weight_s"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "id": "f87cf2c5",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1    70.404545\n",
       "4    90.299091\n",
       "5    85.909091\n",
       "9    85.909091\n",
       "Name: weight, dtype: float64"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "def lbs_to_kgs(lbs):\n",
    "    kgs = float(lbs[:-3]) / 2.2\n",
    "    return kgs\n",
    "\n",
    "lbs_weight_s.apply(lbs_to_kgs)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "id": "30ffed2e",
   "metadata": {},
   "outputs": [],
   "source": [
    "lbs_weight_s = lbs_weight_s.apply(lambda lbs:  \"%.2fkgs\" % (float(lbs[:-3])/2.2)  )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "id": "a0865313",
   "metadata": {},
   "outputs": [],
   "source": [
    "df.loc[lbs_weight_s.index,'weight'] = lbs_weight_s"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "id": "30735bad",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>age</th>\n",
       "      <th>weight</th>\n",
       "      <th>m0006</th>\n",
       "      <th>m0612</th>\n",
       "      <th>m1218</th>\n",
       "      <th>f0006</th>\n",
       "      <th>f0612</th>\n",
       "      <th>f1218</th>\n",
       "      <th>first_name</th>\n",
       "      <th>last_name</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1.0</td>\n",
       "      <td>56.0</td>\n",
       "      <td>70kgs</td>\n",
       "      <td>72</td>\n",
       "      <td>69</td>\n",
       "      <td>71</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>Mickéy</td>\n",
       "      <td>Mousé</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2.0</td>\n",
       "      <td>34.0</td>\n",
       "      <td>70.40kgs</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>85</td>\n",
       "      <td>84</td>\n",
       "      <td>76</td>\n",
       "      <td>Donald</td>\n",
       "      <td>Duck</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3.0</td>\n",
       "      <td>16.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>65</td>\n",
       "      <td>69</td>\n",
       "      <td>72</td>\n",
       "      <td>Mini</td>\n",
       "      <td>Mouse</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>78kgs</td>\n",
       "      <td>78</td>\n",
       "      <td>79</td>\n",
       "      <td>72</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>Scrooge</td>\n",
       "      <td>McDuck</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5.0</td>\n",
       "      <td>54.0</td>\n",
       "      <td>90.30kgs</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>69</td>\n",
       "      <td>NaN</td>\n",
       "      <td>75</td>\n",
       "      <td>Pink</td>\n",
       "      <td>Panther</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>6.0</td>\n",
       "      <td>52.0</td>\n",
       "      <td>85.91kgs</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>68</td>\n",
       "      <td>75</td>\n",
       "      <td>72</td>\n",
       "      <td>Huey</td>\n",
       "      <td>McDuck</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>7.0</td>\n",
       "      <td>19.0</td>\n",
       "      <td>56kgs</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>71</td>\n",
       "      <td>78</td>\n",
       "      <td>75</td>\n",
       "      <td>Dewey</td>\n",
       "      <td>McDuck</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>8.0</td>\n",
       "      <td>32.0</td>\n",
       "      <td>78kgs</td>\n",
       "      <td>78</td>\n",
       "      <td>76</td>\n",
       "      <td>75</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>Scööpy</td>\n",
       "      <td>Doo</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>9.0</td>\n",
       "      <td>52.0</td>\n",
       "      <td>85.91kgs</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>68</td>\n",
       "      <td>75</td>\n",
       "      <td>72</td>\n",
       "      <td>Huey</td>\n",
       "      <td>McDuck</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>10.0</td>\n",
       "      <td>12.0</td>\n",
       "      <td>45kgs</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>92</td>\n",
       "      <td>95</td>\n",
       "      <td>87</td>\n",
       "      <td>Louie</td>\n",
       "      <td>McDuck</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      id   age    weight m0006 m0612 m1218 f0006 f0612 f1218 first_name  \\\n",
       "0    1.0  56.0     70kgs    72    69    71     -     -     -     Mickéy   \n",
       "1    2.0  34.0  70.40kgs     -     -     -    85    84    76     Donald   \n",
       "2    3.0  16.0       NaN     -     -     -    65    69    72       Mini   \n",
       "3    4.0   NaN     78kgs    78    79    72     -     -     -    Scrooge   \n",
       "4    5.0  54.0  90.30kgs     -     -     -    69   NaN    75       Pink   \n",
       "5    6.0  52.0  85.91kgs     -     -     -    68    75    72       Huey   \n",
       "6    7.0  19.0     56kgs     -     -     -    71    78    75      Dewey   \n",
       "7    8.0  32.0     78kgs    78    76    75     -     -     -     Scööpy   \n",
       "8    NaN   NaN       NaN   NaN   NaN   NaN   NaN   NaN   NaN        NaN   \n",
       "9    9.0  52.0  85.91kgs     -     -     -    68    75    72       Huey   \n",
       "10  10.0  12.0     45kgs     -     -     -    92    95    87      Louie   \n",
       "\n",
       "   last_name  \n",
       "0      Mousé  \n",
       "1       Duck  \n",
       "2      Mouse  \n",
       "3     McDuck  \n",
       "4    Panther  \n",
       "5     McDuck  \n",
       "6     McDuck  \n",
       "7        Doo  \n",
       "8        NaN  \n",
       "9     McDuck  \n",
       "10    McDuck  "
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "id": "b0ff3f43",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>age</th>\n",
       "      <th>weight</th>\n",
       "      <th>m0006</th>\n",
       "      <th>m0612</th>\n",
       "      <th>m1218</th>\n",
       "      <th>f0006</th>\n",
       "      <th>f0612</th>\n",
       "      <th>f1218</th>\n",
       "      <th>first_name</th>\n",
       "      <th>last_name</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1.0</td>\n",
       "      <td>56.0</td>\n",
       "      <td>70kgs</td>\n",
       "      <td>72</td>\n",
       "      <td>69</td>\n",
       "      <td>71</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>Mickéy</td>\n",
       "      <td>Mousé</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2.0</td>\n",
       "      <td>34.0</td>\n",
       "      <td>70.40kgs</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>85</td>\n",
       "      <td>84</td>\n",
       "      <td>76</td>\n",
       "      <td>Donald</td>\n",
       "      <td>Duck</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3.0</td>\n",
       "      <td>16.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>65</td>\n",
       "      <td>69</td>\n",
       "      <td>72</td>\n",
       "      <td>Mini</td>\n",
       "      <td>Mouse</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>78kgs</td>\n",
       "      <td>78</td>\n",
       "      <td>79</td>\n",
       "      <td>72</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>Scrooge</td>\n",
       "      <td>McDuck</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5.0</td>\n",
       "      <td>54.0</td>\n",
       "      <td>90.30kgs</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>69</td>\n",
       "      <td>NaN</td>\n",
       "      <td>75</td>\n",
       "      <td>Pink</td>\n",
       "      <td>Panther</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>6.0</td>\n",
       "      <td>52.0</td>\n",
       "      <td>85.91kgs</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>68</td>\n",
       "      <td>75</td>\n",
       "      <td>72</td>\n",
       "      <td>Huey</td>\n",
       "      <td>McDuck</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>7.0</td>\n",
       "      <td>19.0</td>\n",
       "      <td>56kgs</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>71</td>\n",
       "      <td>78</td>\n",
       "      <td>75</td>\n",
       "      <td>Dewey</td>\n",
       "      <td>McDuck</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>10.0</td>\n",
       "      <td>12.0</td>\n",
       "      <td>45kgs</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>92</td>\n",
       "      <td>95</td>\n",
       "      <td>87</td>\n",
       "      <td>Louie</td>\n",
       "      <td>McDuck</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      id   age    weight m0006 m0612 m1218 f0006 f0612 f1218 first_name  \\\n",
       "0    1.0  56.0     70kgs    72    69    71     -     -     -     Mickéy   \n",
       "1    2.0  34.0  70.40kgs     -     -     -    85    84    76     Donald   \n",
       "2    3.0  16.0       NaN     -     -     -    65    69    72       Mini   \n",
       "3    4.0   NaN     78kgs    78    79    72     -     -     -    Scrooge   \n",
       "4    5.0  54.0  90.30kgs     -     -     -    69   NaN    75       Pink   \n",
       "5    6.0  52.0  85.91kgs     -     -     -    68    75    72       Huey   \n",
       "6    7.0  19.0     56kgs     -     -     -    71    78    75      Dewey   \n",
       "10  10.0  12.0     45kgs     -     -     -    92    95    87      Louie   \n",
       "\n",
       "   last_name  \n",
       "0      Mousé  \n",
       "1       Duck  \n",
       "2      Mouse  \n",
       "3     McDuck  \n",
       "4    Panther  \n",
       "5     McDuck  \n",
       "6     McDuck  \n",
       "10    McDuck  "
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.drop_duplicates('weight')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "id": "786c2350",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>age</th>\n",
       "      <th>weight</th>\n",
       "      <th>m0006</th>\n",
       "      <th>m0612</th>\n",
       "      <th>m1218</th>\n",
       "      <th>f0006</th>\n",
       "      <th>f0612</th>\n",
       "      <th>f1218</th>\n",
       "      <th>first_name</th>\n",
       "      <th>last_name</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1.0</td>\n",
       "      <td>56.0</td>\n",
       "      <td>70kgs</td>\n",
       "      <td>72</td>\n",
       "      <td>69</td>\n",
       "      <td>71</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>Mickéy</td>\n",
       "      <td>Mousé</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2.0</td>\n",
       "      <td>34.0</td>\n",
       "      <td>70.40kgs</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>85</td>\n",
       "      <td>84</td>\n",
       "      <td>76</td>\n",
       "      <td>Donald</td>\n",
       "      <td>Duck</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3.0</td>\n",
       "      <td>16.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>65</td>\n",
       "      <td>69</td>\n",
       "      <td>72</td>\n",
       "      <td>Mini</td>\n",
       "      <td>Mouse</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>78kgs</td>\n",
       "      <td>78</td>\n",
       "      <td>79</td>\n",
       "      <td>72</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>Scrooge</td>\n",
       "      <td>McDuck</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5.0</td>\n",
       "      <td>54.0</td>\n",
       "      <td>90.30kgs</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>69</td>\n",
       "      <td>NaN</td>\n",
       "      <td>75</td>\n",
       "      <td>Pink</td>\n",
       "      <td>Panther</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>6.0</td>\n",
       "      <td>52.0</td>\n",
       "      <td>85.91kgs</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>68</td>\n",
       "      <td>75</td>\n",
       "      <td>72</td>\n",
       "      <td>Huey</td>\n",
       "      <td>McDuck</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>7.0</td>\n",
       "      <td>19.0</td>\n",
       "      <td>56kgs</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>71</td>\n",
       "      <td>78</td>\n",
       "      <td>75</td>\n",
       "      <td>Dewey</td>\n",
       "      <td>McDuck</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>8.0</td>\n",
       "      <td>32.0</td>\n",
       "      <td>78kgs</td>\n",
       "      <td>78</td>\n",
       "      <td>76</td>\n",
       "      <td>75</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>Scööpy</td>\n",
       "      <td>Doo</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>10.0</td>\n",
       "      <td>12.0</td>\n",
       "      <td>45kgs</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>92</td>\n",
       "      <td>95</td>\n",
       "      <td>87</td>\n",
       "      <td>Louie</td>\n",
       "      <td>McDuck</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      id   age    weight m0006 m0612 m1218 f0006 f0612 f1218 first_name  \\\n",
       "0    1.0  56.0     70kgs    72    69    71     -     -     -     Mickéy   \n",
       "1    2.0  34.0  70.40kgs     -     -     -    85    84    76     Donald   \n",
       "2    3.0  16.0       NaN     -     -     -    65    69    72       Mini   \n",
       "3    4.0   NaN     78kgs    78    79    72     -     -     -    Scrooge   \n",
       "4    5.0  54.0  90.30kgs     -     -     -    69   NaN    75       Pink   \n",
       "5    6.0  52.0  85.91kgs     -     -     -    68    75    72       Huey   \n",
       "6    7.0  19.0     56kgs     -     -     -    71    78    75      Dewey   \n",
       "7    8.0  32.0     78kgs    78    76    75     -     -     -     Scööpy   \n",
       "8    NaN   NaN       NaN   NaN   NaN   NaN   NaN   NaN   NaN        NaN   \n",
       "10  10.0  12.0     45kgs     -     -     -    92    95    87      Louie   \n",
       "\n",
       "   last_name  \n",
       "0      Mousé  \n",
       "1       Duck  \n",
       "2      Mouse  \n",
       "3     McDuck  \n",
       "4    Panther  \n",
       "5     McDuck  \n",
       "6     McDuck  \n",
       "7        Doo  \n",
       "8        NaN  \n",
       "10    McDuck  "
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.drop_duplicates(['first_name','last_name'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "id": "f35e2d2f",
   "metadata": {},
   "outputs": [],
   "source": [
    "df['first_name'].replace({r'[^\\x00-\\x7F]+':''},regex=True,inplace=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "id": "9ea72c64",
   "metadata": {},
   "outputs": [],
   "source": [
    "df['last_name'].replace({r'[^\\x00-\\x7F]+':''},regex=True,inplace=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "id": "1ff0fe46",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>age</th>\n",
       "      <th>weight</th>\n",
       "      <th>m0006</th>\n",
       "      <th>m0612</th>\n",
       "      <th>m1218</th>\n",
       "      <th>f0006</th>\n",
       "      <th>f0612</th>\n",
       "      <th>f1218</th>\n",
       "      <th>first_name</th>\n",
       "      <th>last_name</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1.0</td>\n",
       "      <td>56.0</td>\n",
       "      <td>70kgs</td>\n",
       "      <td>72</td>\n",
       "      <td>69</td>\n",
       "      <td>71</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>Micky</td>\n",
       "      <td>Mous</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2.0</td>\n",
       "      <td>34.0</td>\n",
       "      <td>70.40kgs</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>85</td>\n",
       "      <td>84</td>\n",
       "      <td>76</td>\n",
       "      <td>Donald</td>\n",
       "      <td>Duck</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3.0</td>\n",
       "      <td>16.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>65</td>\n",
       "      <td>69</td>\n",
       "      <td>72</td>\n",
       "      <td>Mini</td>\n",
       "      <td>Mouse</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>78kgs</td>\n",
       "      <td>78</td>\n",
       "      <td>79</td>\n",
       "      <td>72</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>Scrooge</td>\n",
       "      <td>McDuck</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5.0</td>\n",
       "      <td>54.0</td>\n",
       "      <td>90.30kgs</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>69</td>\n",
       "      <td>NaN</td>\n",
       "      <td>75</td>\n",
       "      <td>Pink</td>\n",
       "      <td>Panther</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>6.0</td>\n",
       "      <td>52.0</td>\n",
       "      <td>85.91kgs</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>68</td>\n",
       "      <td>75</td>\n",
       "      <td>72</td>\n",
       "      <td>Huey</td>\n",
       "      <td>McDuck</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>7.0</td>\n",
       "      <td>19.0</td>\n",
       "      <td>56kgs</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>71</td>\n",
       "      <td>78</td>\n",
       "      <td>75</td>\n",
       "      <td>Dewey</td>\n",
       "      <td>McDuck</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>8.0</td>\n",
       "      <td>32.0</td>\n",
       "      <td>78kgs</td>\n",
       "      <td>78</td>\n",
       "      <td>76</td>\n",
       "      <td>75</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>Scpy</td>\n",
       "      <td>Doo</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>9.0</td>\n",
       "      <td>52.0</td>\n",
       "      <td>85.91kgs</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>68</td>\n",
       "      <td>75</td>\n",
       "      <td>72</td>\n",
       "      <td>Huey</td>\n",
       "      <td>McDuck</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>10.0</td>\n",
       "      <td>12.0</td>\n",
       "      <td>45kgs</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>92</td>\n",
       "      <td>95</td>\n",
       "      <td>87</td>\n",
       "      <td>Louie</td>\n",
       "      <td>McDuck</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      id   age    weight m0006 m0612 m1218 f0006 f0612 f1218 first_name  \\\n",
       "0    1.0  56.0     70kgs    72    69    71     -     -     -      Micky   \n",
       "1    2.0  34.0  70.40kgs     -     -     -    85    84    76     Donald   \n",
       "2    3.0  16.0       NaN     -     -     -    65    69    72       Mini   \n",
       "3    4.0   NaN     78kgs    78    79    72     -     -     -    Scrooge   \n",
       "4    5.0  54.0  90.30kgs     -     -     -    69   NaN    75       Pink   \n",
       "5    6.0  52.0  85.91kgs     -     -     -    68    75    72       Huey   \n",
       "6    7.0  19.0     56kgs     -     -     -    71    78    75      Dewey   \n",
       "7    8.0  32.0     78kgs    78    76    75     -     -     -       Scpy   \n",
       "8    NaN   NaN       NaN   NaN   NaN   NaN   NaN   NaN   NaN        NaN   \n",
       "9    9.0  52.0  85.91kgs     -     -     -    68    75    72       Huey   \n",
       "10  10.0  12.0     45kgs     -     -     -    92    95    87      Louie   \n",
       "\n",
       "   last_name  \n",
       "0       Mous  \n",
       "1       Duck  \n",
       "2      Mouse  \n",
       "3     McDuck  \n",
       "4    Panther  \n",
       "5     McDuck  \n",
       "6     McDuck  \n",
       "7        Doo  \n",
       "8        NaN  \n",
       "9     McDuck  \n",
       "10    McDuck  "
      ]
     },
     "execution_count": 47,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "id": "34acc54c",
   "metadata": {},
   "outputs": [],
   "source": [
    "sorted_columns = ['id','age','weight','first_name','last_name']\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "id": "acbefe36",
   "metadata": {},
   "outputs": [],
   "source": [
    "df = pd.melt(df,\n",
    "             id_vars=sorted_columns,\n",
    "             var_name='sex_hour',\n",
    "             value_name='puls_rate')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "id": "7d7af69c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>age</th>\n",
       "      <th>weight</th>\n",
       "      <th>first_name</th>\n",
       "      <th>last_name</th>\n",
       "      <th>sex_hour</th>\n",
       "      <th>puls_rate</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1.0</td>\n",
       "      <td>56.0</td>\n",
       "      <td>70kgs</td>\n",
       "      <td>Micky</td>\n",
       "      <td>Mous</td>\n",
       "      <td>m0006</td>\n",
       "      <td>72</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2.0</td>\n",
       "      <td>34.0</td>\n",
       "      <td>70.40kgs</td>\n",
       "      <td>Donald</td>\n",
       "      <td>Duck</td>\n",
       "      <td>m0006</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3.0</td>\n",
       "      <td>16.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Mini</td>\n",
       "      <td>Mouse</td>\n",
       "      <td>m0006</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>78kgs</td>\n",
       "      <td>Scrooge</td>\n",
       "      <td>McDuck</td>\n",
       "      <td>m0006</td>\n",
       "      <td>78</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5.0</td>\n",
       "      <td>54.0</td>\n",
       "      <td>90.30kgs</td>\n",
       "      <td>Pink</td>\n",
       "      <td>Panther</td>\n",
       "      <td>m0006</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>61</th>\n",
       "      <td>7.0</td>\n",
       "      <td>19.0</td>\n",
       "      <td>56kgs</td>\n",
       "      <td>Dewey</td>\n",
       "      <td>McDuck</td>\n",
       "      <td>f1218</td>\n",
       "      <td>75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>62</th>\n",
       "      <td>8.0</td>\n",
       "      <td>32.0</td>\n",
       "      <td>78kgs</td>\n",
       "      <td>Scpy</td>\n",
       "      <td>Doo</td>\n",
       "      <td>f1218</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>63</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>f1218</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>64</th>\n",
       "      <td>9.0</td>\n",
       "      <td>52.0</td>\n",
       "      <td>85.91kgs</td>\n",
       "      <td>Huey</td>\n",
       "      <td>McDuck</td>\n",
       "      <td>f1218</td>\n",
       "      <td>72</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>65</th>\n",
       "      <td>10.0</td>\n",
       "      <td>12.0</td>\n",
       "      <td>45kgs</td>\n",
       "      <td>Louie</td>\n",
       "      <td>McDuck</td>\n",
       "      <td>f1218</td>\n",
       "      <td>87</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>66 rows × 7 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      id   age    weight first_name last_name sex_hour puls_rate\n",
       "0    1.0  56.0     70kgs      Micky      Mous    m0006        72\n",
       "1    2.0  34.0  70.40kgs     Donald      Duck    m0006         -\n",
       "2    3.0  16.0       NaN       Mini     Mouse    m0006         -\n",
       "3    4.0   NaN     78kgs    Scrooge    McDuck    m0006        78\n",
       "4    5.0  54.0  90.30kgs       Pink   Panther    m0006         -\n",
       "..   ...   ...       ...        ...       ...      ...       ...\n",
       "61   7.0  19.0     56kgs      Dewey    McDuck    f1218        75\n",
       "62   8.0  32.0     78kgs       Scpy       Doo    f1218         -\n",
       "63   NaN   NaN       NaN        NaN       NaN    f1218       NaN\n",
       "64   9.0  52.0  85.91kgs       Huey    McDuck    f1218        72\n",
       "65  10.0  12.0     45kgs      Louie    McDuck    f1218        87\n",
       "\n",
       "[66 rows x 7 columns]"
      ]
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "id": "04a2a39e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>age</th>\n",
       "      <th>weight</th>\n",
       "      <th>first_name</th>\n",
       "      <th>last_name</th>\n",
       "      <th>sex_hour</th>\n",
       "      <th>puls_rate</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1.0</td>\n",
       "      <td>56.0</td>\n",
       "      <td>70kgs</td>\n",
       "      <td>Micky</td>\n",
       "      <td>Mous</td>\n",
       "      <td>m0006</td>\n",
       "      <td>72</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>1.0</td>\n",
       "      <td>56.0</td>\n",
       "      <td>70kgs</td>\n",
       "      <td>Micky</td>\n",
       "      <td>Mous</td>\n",
       "      <td>m0612</td>\n",
       "      <td>69</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>1.0</td>\n",
       "      <td>56.0</td>\n",
       "      <td>70kgs</td>\n",
       "      <td>Micky</td>\n",
       "      <td>Mous</td>\n",
       "      <td>m1218</td>\n",
       "      <td>71</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>1.0</td>\n",
       "      <td>56.0</td>\n",
       "      <td>70kgs</td>\n",
       "      <td>Micky</td>\n",
       "      <td>Mous</td>\n",
       "      <td>f0006</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>44</th>\n",
       "      <td>1.0</td>\n",
       "      <td>56.0</td>\n",
       "      <td>70kgs</td>\n",
       "      <td>Micky</td>\n",
       "      <td>Mous</td>\n",
       "      <td>f0612</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>55</th>\n",
       "      <td>1.0</td>\n",
       "      <td>56.0</td>\n",
       "      <td>70kgs</td>\n",
       "      <td>Micky</td>\n",
       "      <td>Mous</td>\n",
       "      <td>f1218</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "     id   age weight first_name last_name sex_hour puls_rate\n",
       "0   1.0  56.0  70kgs      Micky      Mous    m0006        72\n",
       "11  1.0  56.0  70kgs      Micky      Mous    m0612        69\n",
       "22  1.0  56.0  70kgs      Micky      Mous    m1218        71\n",
       "33  1.0  56.0  70kgs      Micky      Mous    f0006         -\n",
       "44  1.0  56.0  70kgs      Micky      Mous    f0612         -\n",
       "55  1.0  56.0  70kgs      Micky      Mous    f1218         -"
      ]
     },
     "execution_count": 51,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[df.first_name == 'Micky']\n",
    "# 1.0\t56.0\t70kgs\t72\t69\t71\t-\t-\t-\tMicky\tMous"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "id": "bf4242f6",
   "metadata": {},
   "outputs": [],
   "source": [
    "df = df[df.puls_rate != '-'].dropna()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "id": "e08e7332",
   "metadata": {},
   "outputs": [],
   "source": [
    "df = df.sort_values(['id','first_name','last_name']).reset_index()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "id": "ce3b63cb",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>index</th>\n",
       "      <th>id</th>\n",
       "      <th>age</th>\n",
       "      <th>weight</th>\n",
       "      <th>first_name</th>\n",
       "      <th>last_name</th>\n",
       "      <th>sex_hour</th>\n",
       "      <th>puls_rate</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>56.0</td>\n",
       "      <td>70kgs</td>\n",
       "      <td>Micky</td>\n",
       "      <td>Mous</td>\n",
       "      <td>m0006</td>\n",
       "      <td>72</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>11</td>\n",
       "      <td>1.0</td>\n",
       "      <td>56.0</td>\n",
       "      <td>70kgs</td>\n",
       "      <td>Micky</td>\n",
       "      <td>Mous</td>\n",
       "      <td>m0612</td>\n",
       "      <td>69</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>22</td>\n",
       "      <td>1.0</td>\n",
       "      <td>56.0</td>\n",
       "      <td>70kgs</td>\n",
       "      <td>Micky</td>\n",
       "      <td>Mous</td>\n",
       "      <td>m1218</td>\n",
       "      <td>71</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>34</td>\n",
       "      <td>2.0</td>\n",
       "      <td>34.0</td>\n",
       "      <td>70.40kgs</td>\n",
       "      <td>Donald</td>\n",
       "      <td>Duck</td>\n",
       "      <td>f0006</td>\n",
       "      <td>85</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>45</td>\n",
       "      <td>2.0</td>\n",
       "      <td>34.0</td>\n",
       "      <td>70.40kgs</td>\n",
       "      <td>Donald</td>\n",
       "      <td>Duck</td>\n",
       "      <td>f0612</td>\n",
       "      <td>84</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>56</td>\n",
       "      <td>2.0</td>\n",
       "      <td>34.0</td>\n",
       "      <td>70.40kgs</td>\n",
       "      <td>Donald</td>\n",
       "      <td>Duck</td>\n",
       "      <td>f1218</td>\n",
       "      <td>76</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>37</td>\n",
       "      <td>5.0</td>\n",
       "      <td>54.0</td>\n",
       "      <td>90.30kgs</td>\n",
       "      <td>Pink</td>\n",
       "      <td>Panther</td>\n",
       "      <td>f0006</td>\n",
       "      <td>69</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>59</td>\n",
       "      <td>5.0</td>\n",
       "      <td>54.0</td>\n",
       "      <td>90.30kgs</td>\n",
       "      <td>Pink</td>\n",
       "      <td>Panther</td>\n",
       "      <td>f1218</td>\n",
       "      <td>75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>38</td>\n",
       "      <td>6.0</td>\n",
       "      <td>52.0</td>\n",
       "      <td>85.91kgs</td>\n",
       "      <td>Huey</td>\n",
       "      <td>McDuck</td>\n",
       "      <td>f0006</td>\n",
       "      <td>68</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>49</td>\n",
       "      <td>6.0</td>\n",
       "      <td>52.0</td>\n",
       "      <td>85.91kgs</td>\n",
       "      <td>Huey</td>\n",
       "      <td>McDuck</td>\n",
       "      <td>f0612</td>\n",
       "      <td>75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>60</td>\n",
       "      <td>6.0</td>\n",
       "      <td>52.0</td>\n",
       "      <td>85.91kgs</td>\n",
       "      <td>Huey</td>\n",
       "      <td>McDuck</td>\n",
       "      <td>f1218</td>\n",
       "      <td>72</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>39</td>\n",
       "      <td>7.0</td>\n",
       "      <td>19.0</td>\n",
       "      <td>56kgs</td>\n",
       "      <td>Dewey</td>\n",
       "      <td>McDuck</td>\n",
       "      <td>f0006</td>\n",
       "      <td>71</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>50</td>\n",
       "      <td>7.0</td>\n",
       "      <td>19.0</td>\n",
       "      <td>56kgs</td>\n",
       "      <td>Dewey</td>\n",
       "      <td>McDuck</td>\n",
       "      <td>f0612</td>\n",
       "      <td>78</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>61</td>\n",
       "      <td>7.0</td>\n",
       "      <td>19.0</td>\n",
       "      <td>56kgs</td>\n",
       "      <td>Dewey</td>\n",
       "      <td>McDuck</td>\n",
       "      <td>f1218</td>\n",
       "      <td>75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>7</td>\n",
       "      <td>8.0</td>\n",
       "      <td>32.0</td>\n",
       "      <td>78kgs</td>\n",
       "      <td>Scpy</td>\n",
       "      <td>Doo</td>\n",
       "      <td>m0006</td>\n",
       "      <td>78</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>18</td>\n",
       "      <td>8.0</td>\n",
       "      <td>32.0</td>\n",
       "      <td>78kgs</td>\n",
       "      <td>Scpy</td>\n",
       "      <td>Doo</td>\n",
       "      <td>m0612</td>\n",
       "      <td>76</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>29</td>\n",
       "      <td>8.0</td>\n",
       "      <td>32.0</td>\n",
       "      <td>78kgs</td>\n",
       "      <td>Scpy</td>\n",
       "      <td>Doo</td>\n",
       "      <td>m1218</td>\n",
       "      <td>75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>42</td>\n",
       "      <td>9.0</td>\n",
       "      <td>52.0</td>\n",
       "      <td>85.91kgs</td>\n",
       "      <td>Huey</td>\n",
       "      <td>McDuck</td>\n",
       "      <td>f0006</td>\n",
       "      <td>68</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>53</td>\n",
       "      <td>9.0</td>\n",
       "      <td>52.0</td>\n",
       "      <td>85.91kgs</td>\n",
       "      <td>Huey</td>\n",
       "      <td>McDuck</td>\n",
       "      <td>f0612</td>\n",
       "      <td>75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>64</td>\n",
       "      <td>9.0</td>\n",
       "      <td>52.0</td>\n",
       "      <td>85.91kgs</td>\n",
       "      <td>Huey</td>\n",
       "      <td>McDuck</td>\n",
       "      <td>f1218</td>\n",
       "      <td>72</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>43</td>\n",
       "      <td>10.0</td>\n",
       "      <td>12.0</td>\n",
       "      <td>45kgs</td>\n",
       "      <td>Louie</td>\n",
       "      <td>McDuck</td>\n",
       "      <td>f0006</td>\n",
       "      <td>92</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>54</td>\n",
       "      <td>10.0</td>\n",
       "      <td>12.0</td>\n",
       "      <td>45kgs</td>\n",
       "      <td>Louie</td>\n",
       "      <td>McDuck</td>\n",
       "      <td>f0612</td>\n",
       "      <td>95</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>65</td>\n",
       "      <td>10.0</td>\n",
       "      <td>12.0</td>\n",
       "      <td>45kgs</td>\n",
       "      <td>Louie</td>\n",
       "      <td>McDuck</td>\n",
       "      <td>f1218</td>\n",
       "      <td>87</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    index    id   age    weight first_name last_name sex_hour puls_rate\n",
       "0       0   1.0  56.0     70kgs      Micky      Mous    m0006        72\n",
       "1      11   1.0  56.0     70kgs      Micky      Mous    m0612        69\n",
       "2      22   1.0  56.0     70kgs      Micky      Mous    m1218        71\n",
       "3      34   2.0  34.0  70.40kgs     Donald      Duck    f0006        85\n",
       "4      45   2.0  34.0  70.40kgs     Donald      Duck    f0612        84\n",
       "5      56   2.0  34.0  70.40kgs     Donald      Duck    f1218        76\n",
       "6      37   5.0  54.0  90.30kgs       Pink   Panther    f0006        69\n",
       "7      59   5.0  54.0  90.30kgs       Pink   Panther    f1218        75\n",
       "8      38   6.0  52.0  85.91kgs       Huey    McDuck    f0006        68\n",
       "9      49   6.0  52.0  85.91kgs       Huey    McDuck    f0612        75\n",
       "10     60   6.0  52.0  85.91kgs       Huey    McDuck    f1218        72\n",
       "11     39   7.0  19.0     56kgs      Dewey    McDuck    f0006        71\n",
       "12     50   7.0  19.0     56kgs      Dewey    McDuck    f0612        78\n",
       "13     61   7.0  19.0     56kgs      Dewey    McDuck    f1218        75\n",
       "14      7   8.0  32.0     78kgs       Scpy       Doo    m0006        78\n",
       "15     18   8.0  32.0     78kgs       Scpy       Doo    m0612        76\n",
       "16     29   8.0  32.0     78kgs       Scpy       Doo    m1218        75\n",
       "17     42   9.0  52.0  85.91kgs       Huey    McDuck    f0006        68\n",
       "18     53   9.0  52.0  85.91kgs       Huey    McDuck    f0612        75\n",
       "19     64   9.0  52.0  85.91kgs       Huey    McDuck    f1218        72\n",
       "20     43  10.0  12.0     45kgs      Louie    McDuck    f0006        92\n",
       "21     54  10.0  12.0     45kgs      Louie    McDuck    f0612        95\n",
       "22     65  10.0  12.0     45kgs      Louie    McDuck    f1218        87"
      ]
     },
     "execution_count": 59,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "id": "44f440ed",
   "metadata": {},
   "outputs": [],
   "source": [
    "def split_sex_date(sex_hour):\n",
    "    sex = sex_hour[:1]\n",
    "    if 'f' == sex:\n",
    "        sex = '女'\n",
    "    elif 'm' == sex:\n",
    "        sex = '男'\n",
    "    hour = sex_hour[1:]\n",
    "    return pd.Series([sex,hour])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "id": "ce8686e5",
   "metadata": {},
   "outputs": [],
   "source": [
    "df[['sex','hour']] = df.sex_hour.apply(split_sex_date)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 66,
   "id": "e680247d",
   "metadata": {},
   "outputs": [],
   "source": [
    "df.drop('sex_hour',axis=1).to_csv(\"data/new_patient_data.csv\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "id": "35f68d49",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>index</th>\n",
       "      <th>id</th>\n",
       "      <th>age</th>\n",
       "      <th>weight</th>\n",
       "      <th>first_name</th>\n",
       "      <th>last_name</th>\n",
       "      <th>puls_rate</th>\n",
       "      <th>sex</th>\n",
       "      <th>hour</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>56.0</td>\n",
       "      <td>70kgs</td>\n",
       "      <td>Micky</td>\n",
       "      <td>Mous</td>\n",
       "      <td>72</td>\n",
       "      <td>男</td>\n",
       "      <td>0006</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>11</td>\n",
       "      <td>1.0</td>\n",
       "      <td>56.0</td>\n",
       "      <td>70kgs</td>\n",
       "      <td>Micky</td>\n",
       "      <td>Mous</td>\n",
       "      <td>69</td>\n",
       "      <td>男</td>\n",
       "      <td>0612</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>22</td>\n",
       "      <td>1.0</td>\n",
       "      <td>56.0</td>\n",
       "      <td>70kgs</td>\n",
       "      <td>Micky</td>\n",
       "      <td>Mous</td>\n",
       "      <td>71</td>\n",
       "      <td>男</td>\n",
       "      <td>1218</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>34</td>\n",
       "      <td>2.0</td>\n",
       "      <td>34.0</td>\n",
       "      <td>70.40kgs</td>\n",
       "      <td>Donald</td>\n",
       "      <td>Duck</td>\n",
       "      <td>85</td>\n",
       "      <td>女</td>\n",
       "      <td>0006</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>45</td>\n",
       "      <td>2.0</td>\n",
       "      <td>34.0</td>\n",
       "      <td>70.40kgs</td>\n",
       "      <td>Donald</td>\n",
       "      <td>Duck</td>\n",
       "      <td>84</td>\n",
       "      <td>女</td>\n",
       "      <td>0612</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>56</td>\n",
       "      <td>2.0</td>\n",
       "      <td>34.0</td>\n",
       "      <td>70.40kgs</td>\n",
       "      <td>Donald</td>\n",
       "      <td>Duck</td>\n",
       "      <td>76</td>\n",
       "      <td>女</td>\n",
       "      <td>1218</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>37</td>\n",
       "      <td>5.0</td>\n",
       "      <td>54.0</td>\n",
       "      <td>90.30kgs</td>\n",
       "      <td>Pink</td>\n",
       "      <td>Panther</td>\n",
       "      <td>69</td>\n",
       "      <td>女</td>\n",
       "      <td>0006</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>59</td>\n",
       "      <td>5.0</td>\n",
       "      <td>54.0</td>\n",
       "      <td>90.30kgs</td>\n",
       "      <td>Pink</td>\n",
       "      <td>Panther</td>\n",
       "      <td>75</td>\n",
       "      <td>女</td>\n",
       "      <td>1218</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>38</td>\n",
       "      <td>6.0</td>\n",
       "      <td>52.0</td>\n",
       "      <td>85.91kgs</td>\n",
       "      <td>Huey</td>\n",
       "      <td>McDuck</td>\n",
       "      <td>68</td>\n",
       "      <td>女</td>\n",
       "      <td>0006</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>49</td>\n",
       "      <td>6.0</td>\n",
       "      <td>52.0</td>\n",
       "      <td>85.91kgs</td>\n",
       "      <td>Huey</td>\n",
       "      <td>McDuck</td>\n",
       "      <td>75</td>\n",
       "      <td>女</td>\n",
       "      <td>0612</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>60</td>\n",
       "      <td>6.0</td>\n",
       "      <td>52.0</td>\n",
       "      <td>85.91kgs</td>\n",
       "      <td>Huey</td>\n",
       "      <td>McDuck</td>\n",
       "      <td>72</td>\n",
       "      <td>女</td>\n",
       "      <td>1218</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>39</td>\n",
       "      <td>7.0</td>\n",
       "      <td>19.0</td>\n",
       "      <td>56kgs</td>\n",
       "      <td>Dewey</td>\n",
       "      <td>McDuck</td>\n",
       "      <td>71</td>\n",
       "      <td>女</td>\n",
       "      <td>0006</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>50</td>\n",
       "      <td>7.0</td>\n",
       "      <td>19.0</td>\n",
       "      <td>56kgs</td>\n",
       "      <td>Dewey</td>\n",
       "      <td>McDuck</td>\n",
       "      <td>78</td>\n",
       "      <td>女</td>\n",
       "      <td>0612</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>61</td>\n",
       "      <td>7.0</td>\n",
       "      <td>19.0</td>\n",
       "      <td>56kgs</td>\n",
       "      <td>Dewey</td>\n",
       "      <td>McDuck</td>\n",
       "      <td>75</td>\n",
       "      <td>女</td>\n",
       "      <td>1218</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>7</td>\n",
       "      <td>8.0</td>\n",
       "      <td>32.0</td>\n",
       "      <td>78kgs</td>\n",
       "      <td>Scpy</td>\n",
       "      <td>Doo</td>\n",
       "      <td>78</td>\n",
       "      <td>男</td>\n",
       "      <td>0006</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>18</td>\n",
       "      <td>8.0</td>\n",
       "      <td>32.0</td>\n",
       "      <td>78kgs</td>\n",
       "      <td>Scpy</td>\n",
       "      <td>Doo</td>\n",
       "      <td>76</td>\n",
       "      <td>男</td>\n",
       "      <td>0612</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>29</td>\n",
       "      <td>8.0</td>\n",
       "      <td>32.0</td>\n",
       "      <td>78kgs</td>\n",
       "      <td>Scpy</td>\n",
       "      <td>Doo</td>\n",
       "      <td>75</td>\n",
       "      <td>男</td>\n",
       "      <td>1218</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>42</td>\n",
       "      <td>9.0</td>\n",
       "      <td>52.0</td>\n",
       "      <td>85.91kgs</td>\n",
       "      <td>Huey</td>\n",
       "      <td>McDuck</td>\n",
       "      <td>68</td>\n",
       "      <td>女</td>\n",
       "      <td>0006</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>53</td>\n",
       "      <td>9.0</td>\n",
       "      <td>52.0</td>\n",
       "      <td>85.91kgs</td>\n",
       "      <td>Huey</td>\n",
       "      <td>McDuck</td>\n",
       "      <td>75</td>\n",
       "      <td>女</td>\n",
       "      <td>0612</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>64</td>\n",
       "      <td>9.0</td>\n",
       "      <td>52.0</td>\n",
       "      <td>85.91kgs</td>\n",
       "      <td>Huey</td>\n",
       "      <td>McDuck</td>\n",
       "      <td>72</td>\n",
       "      <td>女</td>\n",
       "      <td>1218</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>43</td>\n",
       "      <td>10.0</td>\n",
       "      <td>12.0</td>\n",
       "      <td>45kgs</td>\n",
       "      <td>Louie</td>\n",
       "      <td>McDuck</td>\n",
       "      <td>92</td>\n",
       "      <td>女</td>\n",
       "      <td>0006</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>54</td>\n",
       "      <td>10.0</td>\n",
       "      <td>12.0</td>\n",
       "      <td>45kgs</td>\n",
       "      <td>Louie</td>\n",
       "      <td>McDuck</td>\n",
       "      <td>95</td>\n",
       "      <td>女</td>\n",
       "      <td>0612</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>65</td>\n",
       "      <td>10.0</td>\n",
       "      <td>12.0</td>\n",
       "      <td>45kgs</td>\n",
       "      <td>Louie</td>\n",
       "      <td>McDuck</td>\n",
       "      <td>87</td>\n",
       "      <td>女</td>\n",
       "      <td>1218</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    index    id   age    weight first_name last_name puls_rate sex  hour\n",
       "0       0   1.0  56.0     70kgs      Micky      Mous        72   男  0006\n",
       "1      11   1.0  56.0     70kgs      Micky      Mous        69   男  0612\n",
       "2      22   1.0  56.0     70kgs      Micky      Mous        71   男  1218\n",
       "3      34   2.0  34.0  70.40kgs     Donald      Duck        85   女  0006\n",
       "4      45   2.0  34.0  70.40kgs     Donald      Duck        84   女  0612\n",
       "5      56   2.0  34.0  70.40kgs     Donald      Duck        76   女  1218\n",
       "6      37   5.0  54.0  90.30kgs       Pink   Panther        69   女  0006\n",
       "7      59   5.0  54.0  90.30kgs       Pink   Panther        75   女  1218\n",
       "8      38   6.0  52.0  85.91kgs       Huey    McDuck        68   女  0006\n",
       "9      49   6.0  52.0  85.91kgs       Huey    McDuck        75   女  0612\n",
       "10     60   6.0  52.0  85.91kgs       Huey    McDuck        72   女  1218\n",
       "11     39   7.0  19.0     56kgs      Dewey    McDuck        71   女  0006\n",
       "12     50   7.0  19.0     56kgs      Dewey    McDuck        78   女  0612\n",
       "13     61   7.0  19.0     56kgs      Dewey    McDuck        75   女  1218\n",
       "14      7   8.0  32.0     78kgs       Scpy       Doo        78   男  0006\n",
       "15     18   8.0  32.0     78kgs       Scpy       Doo        76   男  0612\n",
       "16     29   8.0  32.0     78kgs       Scpy       Doo        75   男  1218\n",
       "17     42   9.0  52.0  85.91kgs       Huey    McDuck        68   女  0006\n",
       "18     53   9.0  52.0  85.91kgs       Huey    McDuck        75   女  0612\n",
       "19     64   9.0  52.0  85.91kgs       Huey    McDuck        72   女  1218\n",
       "20     43  10.0  12.0     45kgs      Louie    McDuck        92   女  0006\n",
       "21     54  10.0  12.0     45kgs      Louie    McDuck        95   女  0612\n",
       "22     65  10.0  12.0     45kgs      Louie    McDuck        87   女  1218"
      ]
     },
     "execution_count": 67,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.drop('sex_hour',axis=1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "449df05c",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
